package com.example.activemqp2p.webcontroller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jms.core.JmsMessagingTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * \* @author: wky
 * \* Date: 2022/10/08
 * \* Time: 11:03
 * \* To change this template use File | Settings | File Templates.
 * \* Description:SendActiveMsg
 * \
 */
@RestController
@RequestMapping("/test")
public class SendActiveMsg {

    @Autowired
    private JmsMessagingTemplate jmsMessagingTemplate;

    @RequestMapping("/sendmsg")
    private String sendMsg(@RequestParam(name = "msg")String msg) {
        jmsMessagingTemplate.convertAndSend("wkyqueue",msg);

        return "send " + msg +  ",OK!";
    }
}